$(document).ready(function() {
//    $.ajaxSetup({
//            url: clientApiUrl,
//            dataType: "json",
//            cache: false,
//            async:false,
//            error: function(XMLHttpResponse) {
//                //handleError(XMLHttpResponse);
//            },
//            beforeSend: function(XMLHttpRequest) {
//                    
//            }		
//    });
})


 function showError(mess){
    var $errorInfo = $("#right_panel_content #after_action_info_container_on_top");    
    $errorInfo.find("#after_action_info").text(mess);        
    $errorInfo.show();
 }
 function addCommas(nStr)
    {
        nStr = Math.round(nStr);
    	nStr += '';
    	x = nStr.split('.');
    	x1 = x[0];
    	x2 = x.length > 1 ? '.' + x[1] : '';
    	var rgx = /(\d+)(\d{3})/;
    	while (rgx.test(x1)) {
    		x1 = x1.replace(rgx, '$1' + ',' + '$2');
    	}
    	return x1 + x2;
    }
 function clearconsole() { 
    console.log(window.console);
    if(window.console || window.console.firebug) {
        console.clear();
    }
}

 function parseString(str,find,i){
    arr = str.split(find);
    return arr[i];
 }

 function getPriceOfService(apiName,$priceTag,$vatTag,$totalTag,$currencyTag,$discountInfoTag,month){
    var price =0,
    currency ="VND",
    discount =0,
    total =0,
    vat = 0;

    var discountPer =0;
    var discountMoney =0;
    var arrPrice ={};   
    $priceTag.css("text-decoration","");
    $priceTag.empty(); 
    $discountInfoTag.empty();
    $vatTag.empty();
    $totalTag.empty();
    $currencyTag.text("");
    $.ajax({
        url: createURLBilling1(apiName),
        dataType: "xml",
        async: false,
        success: function(xml) {
            $(xml).find('priceResponse').each(function(){
                if ($(this).find('price').length > 0){
                    price = parseFloat($(this).find("price").text());
                    currency = $(this).find('currency').text();
                    discountPer = $(this).find('discountPer').text();
                    discountPer = parseFloat(discountPer);
                    discountMoney = $(this).find('discountMoney').text();   
                    discountMoney = parseFloat(discountMoney);     
                }                  
            })
            arrPrice['currency'] = currency;
            arrPrice['price'] = price*month;
            price = price * month;
            total = price;
            
            if (discountPer > 0 || discountMoney > 0){
                discount = price - price*discountPer*0.01;
                discount = discount - discountMoney;
                discount = (discount<=0)?0:discount;
            	setDiscoutInfo(discountPer, discountMoney, currency,$discountInfoTag);
                //$priceTag.css("text-decoration","line-through");
                total = discount;
                discount = addCommas(discount);
            }else{
            	$discountInfoTag.text("--");

            }
            
            //price = price * month;
            //discount = discount*month;
            //total = total* month;
            
            var checkvat = $.cookie("hasvat");
            if (checkvat == 1){
                vat = total *0.1;
            }

            arrPrice['totalBefore']=total;
            total = total + vat;
            arrPrice['totalAfter']=total;
            arrPrice['total']=total;
            arrPrice['vat']=vat;
            price = addCommas(price);
            vat = addCommas(vat);
            total = addCommas(total);
            $priceTag.text(price + " " + currency);
            $vatTag.text(vat);
            $totalTag.text(total + " " + currency).css("color","blue").css("font-weight","bold").css("font-size","medium");
            $currencyTag.text(currency);
        }
    });
    return arrPrice;
}

function createURL(url) {
    return url +"&response=json&sessionkey=" + g_sessionKey;
}

function fromdb(val) {
    return sanitizeXSS(noNull(val));
}

function todb(val) {
    return encodeURIComponent(val);
}

var midmenuItemCount = 20;

function setBooleanReadField(value, $field) {
    if(value == "true" || value == true)
        $field.text("Yes").show();
    else if(value == "false" || value == false)
        $field.text("No").show();	
    else
        $field.hide();
}

function setBooleanEditField(value, $field) {
    if(value == "true" || value == true)
        $field.val("true");
    else if(value == "false" || value == false)
        $field.val("false");	
    else
        $field.hide();
}

function initDialog(elementId, width1, addToActive) {
	if(width1 == null) {
	    activateDialog($("#"+elementId).dialog({    	            
	        autoOpen: false,
	        modal: true,
	        zIndex: 2000
        }), addToActive); 
    }
    else {
        activateDialog($("#"+elementId).dialog({ 
   	        width: width1,	
	        autoOpen: false,
	        modal: true,
	        zIndex: 2000
        }), addToActive); 
    }
} 

function initDialogWithOK(elementId, width1, addToActive) {
	if(width1 == null) {
	    activateDialog($("#"+elementId).dialog({    	            
	        autoOpen: false,
	        modal: true,
	        zIndex: 2000,
	        buttons: { "OK": function() { $(this).dialog("close"); } }
        }), addToActive); 
    }
    else {
        activateDialog($("#"+elementId).dialog({ 
   	        width: width1,	
	        autoOpen: false,
	        modal: true,
	        zIndex: 2000,
	        buttons: { "OK": function() { $(this).dialog("close"); } }
        }), addToActive); 
    }
} 

function parseXMLHttpResponse(XMLHttpResponse) {	
	if(isValidJsonString(XMLHttpResponse.responseText) == false) {
	    return "";
	}
	
	//var json = jQuery.parseJSON(XMLHttpResponse.responseText);	
	var json = JSON.parse(XMLHttpResponse.responseText);
	if (json != null) {
		var property;
		for(property in json) {}
		var errorObj = json[property];
		return fromdb(errorObj.errortext);	
	} else {
		return "";
	}
}

function isValidJsonString(str) {
    try {         
        JSON.parse(str);     
    } 
    catch (e) {         
        return false;     
    }     
    return true;
}



function initResizable(resizeElement, alsoResizeElement) {         
    var alsoResizeUi_originalHeight;
    $("#"+resizeElement).resizable({
        handles: 'e, w',
        autoHide: true,            
        //containment: ".grid_header"  , 
        alsoResize: "."+alsoResizeElement
    }); 
}
    
var sortBy = "";
var parseFunction = function() {}
var sortingOrder = "asc";

function sortArrayAlphabetically(a, b) {      
    if(a[sortBy] == null || b[sortBy] == null)
        return 0;
      
    var A = a[sortBy].toLowerCase();
    var B = b[sortBy].toLowerCase();
    
    if(sortingOrder == "asc") {
        if (A < B) 
            return -1;
        if (A > B) 
            return 1;
    } else {
        if (A < B) 
            return 1;
        if (A > B) 
            return -1;
    }
    return 0;
}	    

function sortArrayAlphabeticallyParse(a, b) {     
    if(a[sortBy] == null || b[sortBy] == null)
        return 0;
             
    var A = parseFunction(a[sortBy]).toLowerCase();
    var B = parseFunction(b[sortBy]).toLowerCase();
    
    if(sortingOrder == "asc") {
        if (A < B) 
            return -1;
        if (A > B) 
            return 1;
    } else {
        if (A < B) 
            return 1;
        if (A > B) 
            return -1;
    }
    return 0;
}	 

function sortArrayNumerically(a, b) {      
    if(a[sortBy] == null || b[sortBy] == null)
        return 0;
      
    var A = parseInt(a[sortBy]);
    var B = parseInt(b[sortBy]);
    
    if(sortingOrder == "asc") {
        if (A < B) 
            return -1;
        if (A > B) 
            return 1;
    } else {
        if (A < B) 
            return 1;
        if (A > B) 
            return -1;
    }
    return 0;
}

function sortArrayNumericallyParse(a, b) {     
    if(a[sortBy] == null || b[sortBy] == null)
        return 0;
     
    var A = parseFunction(parseInt(a[sortBy]));
    var B = parseFunction(parseInt(b[sortBy]));
        
    if(sortingOrder == "asc") {
        if (A < B) 
            return -1;
        if (A > B) 
            return 1;
    } else {
        if (A < B) 
            return 1;
        if (A > B) 
            return -1;
    }
    return 0;
}   

function sortArrayByDate(a, b) {    
    if(a[sortBy] == null || b[sortBy] == null)
        return 0;
        
    var A = convertMilliseconds(a[sortBy]);
    var B = convertMilliseconds(b[sortBy]);
    
    if(sortingOrder == "asc") {
        if (A < B) 
            return -1;
        if (A > B) 
            return 1;
    } else {
        if (A < B) 
            return 1;
        if (A > B) 
            return -1;
    }
    return 0;
}	

function convertMilliseconds(string) {
    if (string != null && string.length > 0) {
	    var date1 = new Date();
	    date1.setISO8601(string);	
	    return date1.getTime();	    
    } else {
        return null;
    }
}    

// Validation functions
function showError(isValid, field, errMsgField, errMsg) {    
	if(isValid) {
	    errMsgField.text("").hide();
	    field.addClass("text").removeClass("error_text");
	}
	else {
	    errMsgField.text(errMsg).show();
	    field.removeClass("text").addClass("error_text");	
	}
}

function showError2(isValid, field, errMsgField, errMsg, appendErrMsg) {    
	if(isValid) {
	    errMsgField.text("").hide();
	    field.addClass("text2").removeClass("error_text2");
	}
	else {
	    if(appendErrMsg) //append text
	        errMsgField.text(errMsgField.text()+errMsg).show();  
	    else  //reset text
	        errMsgField.text(errMsg).show();  
	    field.removeClass("text2").addClass("error_text2");	
	}
}

function showErrorInDropdown(isValid, field, errMsgField, errMsg, appendErrMsg) {    
	if(isValid) {
	    errMsgField.text("").hide();
	    field.addClass("select").removeClass("error_select");
	}
	else {
	    if(appendErrMsg) //append text
	        errMsgField.text(errMsgField.text()+errMsg).show();  
	    else  //reset text
	        errMsgField.text(errMsg).show();  
	    field.removeClass("select").addClass("error_select");	
	}
}

function validateDropDownBox(label, field, errMsgField, appendErrMsg) {  
    var isValid = true;
    var errMsg = "";   
    var value = field.val();     
	if (value == null || value.length == 0) {	   
	    //errMsg = label + " is a required value. ";	  
	    errMsg = g_dictionary["label.required"]; 
		isValid = false;		
	} 		
	showErrorInDropdown(isValid, field, errMsgField, errMsg, appendErrMsg);	
	return isValid;
}

function validateInteger(label, field, errMsgField, min, max, isOptional) {
    return validateNumber(label, field, errMsgField, min, max, isOptional, "integer");    
}

function validateNumber(label, field, errMsgField, min, max, isOptional, type) {
    var isValid = true;
    var errMsg = "";
    var value = field.val();  
         
	if (value != null && value.length != 0) {
		if(isNaN(value)) {
			//errMsg = label + " must be a number";
			errMsg = g_dictionary["label.invalid.number"]; 
			isValid = false;
		} 
		else {
		    if(type == "integer" && (value % 1) != 0) {
		        //errMsg = label + " must be an integer";
		        errMsg = g_dictionary["label.invalid.integer"]; 
				isValid = false;
		    }
		
			if (min != null && value < min) {
				//errMsg = label + " must be a value greater than or equal to " + min;
				errMsg = g_dictionary["label.minimum"] + ": " + min; 
				isValid = false;
			}
			if (max != null && value > max) {
				//errMsg = label + " must be a value less than or equal to " + max;
				errMsg = g_dictionary["label.maximum"] + ": " + max; 
				isValid = false;
			}
		}
	}
	else if(isOptional!=true){  //required field
		//errMsg = label + " is a required value. ";
		errMsg = g_dictionary["label.required"]; 
		isValid = false;
	}
	showError(isValid, field, errMsgField, errMsg);	
	return isValid;
}

function validateString(label, field, errMsgField, isOptional, maxLength) {  
    var isValid = true;
    var errMsg = "";
    var value = field.val();     
	if (isOptional!=true && (value == null || value.length == 0)) {	 //required field   
	    //errMsg = label + " is a required value. ";	  
	    errMsg = g_dictionary["label.required"];  
		isValid = false;		
	} 	
	else if (value!=null && value.length >= maxLength) {	    
	    //errMsg = label + " must be less than " + maxLength + " characters";	 
	    errMsg = g_dictionary["label.maximum"] + ": " + max + " " + g_dictionary["label.character"];   
		isValid = false;		
	} 	
	else if(value!=null && value.indexOf('"')!=-1) {
	    //errMsg = "Double quotes are not allowed";	
	    errMsg = g_dictionary["label.double.quotes.are.not.allowed"];   
		isValid = false;	
	}
	showError(isValid, field, errMsgField, errMsg);	
	return isValid;
}

function validateEmail(label, field, errMsgField, isOptional) {  
    if(validateString(label, field, errMsgField, isOptional) == false)
        return;
    var isValid = true;
    var errMsg = "";
    var value = field.val();     		    
    if(value!=null && value.length>0) {
        myregexp = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;   
        var isMatch = myregexp.test(value);
        if(!isMatch) {            
            errMsg = g_dictionary["label.example"] + ": xxxxxxx@hotmail.com";
	        isValid = false;		
	    }
	}	 	
	showError(isValid, field, errMsgField, errMsg);	
	return isValid;
}

function validateIp(label, field, errMsgField, isOptional) {  
    if(validateString(label, field, errMsgField, isOptional) == false)
        return;
    var isValid = true;
    var errMsg = "";
    var value = field.val();     		    
    if(value!=null && value.length>0) {
        //myregexp = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;	
        //myregexp = "^(?:(?:25[0-5]2[0-4][0-9][01]?[0-9][0-9]?)\.){3}" +
                        //"(?:25[0-5]2[0-4][0-9][01]?[0-9][0-9]?)$";
        myregexp = "^(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{2}"+
                        "|[0-9])(\.(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[0-9]{2}|[0-9])){3}$";
        //var isMatch = myregexp.test(value);
        isMatch = value.match(myregexp);
        if(!isMatch) {
            //errMsg = label + " should be like 75.52.126.11";	   
            errMsg = g_dictionary["label.example"] + ": 75.52.126.11";
	        isValid = false;		
	    }
	}	 	
	showError(isValid, field, errMsgField, errMsg);	
	return isValid;
}

function validateNetmask(label, field, errMsgField, isOptional) {  
    if(validateString(label, field, errMsgField, isOptional) == false)
        return;
    var isValid = true;
    var errMsg = "";
    var value = field.val();     		    
    if(value!=null && value.length>0) {
        myregexp = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;	   
        var isMatch = myregexp.test(value);
        if(!isMatch) {            
            errMsg = g_dictionary["label.example"] + ": 255.255.255.0";
	        isValid = false;		
	    }
	}	 	
	showError(isValid, field, errMsgField, errMsg);	
	return isValid;
}


function validateCIDR(label, field, errMsgField, isOptional) {  
    if(validateString(label, field, errMsgField, isOptional) == false)
        return;        
    var isValid = true;
    var errMsg = "";
    var value = field.val();     
    if(value!=null && value.length>0) {
        myregexp = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/\d{1,2}$/;	   
        var isMatch = myregexp.test(value);
        if(!isMatch) {
            //errMsg = label + " should be like 10.1.1.0/24";	   
            errMsg = g_dictionary["label.example"] + ": 10.1.1.0/24";
	        isValid = false;		
	    }
	}	
	showError(isValid, field, errMsgField, errMsg);	
	return isValid;
}

function validateCIDRList(label, field, errMsgField, isOptional) {  	
    if(validateString(label, field, errMsgField, isOptional) == false)
        return;        
    var isValid = true;
    var errMsg = "";
    var cidrList = field.val();    
        
    var array1 = cidrList.split(",");
    for(var i=0; i < array1.length; i++) {
        var value = array1[i];   
        if(value!=null && value.length>0) {
            myregexp = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/\d{1,2}$/;	   
            var isMatch = myregexp.test(value);
            if(!isMatch) { 
    	        isValid = false;		
    	    }
    	}	
    }       
    if(isValid == false)
    	errMsg = g_dictionary["label.example"] + ": 10.1.1.0/24,10.1.1.1/24,10.1.1.2/24";
    
	showError(isValid, field, errMsgField, errMsg);	
	return isValid;
}

/*
function validateFilename(label, field, errMsgField, isOptional) {  
    if(validateString(label, field, errMsgField, isOptional) == false)
        return;        
    var isValid = true;
    var errMsg = "";
    var value = field.val();     
    if(value!=null && value.length>0) {
        myregexp = /[^a-zA-Z0-9_\-\.]/;	   
        var isMatch = myregexp.test(value);
        if(isMatch) {
            errMsg = "Only alphanumeric, dot, dashes and underscore characters allowed";	   
	        isValid = false;		
	    }
	}	
	showError(isValid, field, errMsgField, errMsg);	
	return isValid;
}
*/

function validatePath(label, field, errMsgField, isOptional) {  
    if(validateString(label, field, errMsgField, isOptional) == false)
        return;
    var isValid = true;
    var errMsg = "";
    var value = field.val();    
    if(value!=null && value.length>0) {
        myregexp = /^\//;	   
        var isMatch = myregexp.test(value);
        if(!isMatch) {
            errMsg = label + " should be like /aaa/bbb/ccc";	   
	        isValid = false;		
	    }
	}	 	
	showError(isValid, field, errMsgField, errMsg);	
	return isValid;
}


// others
function trim(val) {
    if(val == null)
        return null;
    return val.replace(/^\s*/, "").replace(/\s*$/, "");
}

function noNull(val) {
    if(val == null)
        return "";
    else
        return val;
}

// Prevent cross-site-script(XSS) attack. 
// used right before adding user input to the DOM tree. e.g. DOM_element.html(fromdb(user_input));  
function sanitizeXSS(val) {     
    if(val == null || typeof(val) != "string")
        return val; 
    val = val.replace(/</g, "&lt;");  //replace < whose unicode is \u003c     
    val = val.replace(/>/g, "&gt;");  //replace > whose unicode is \u003e  
    return unescape(val);
}

var midMenuFirstRowLength = 26;
var midMenuSecondRowLength = 33;
function clippedText(text, maxLength) {
	if(text.length <= maxLength)
		return text;
	else
		return text.substring(0,maxLength-3)+"...";	
}

function getVmName(p_vmName, p_vmDisplayname) {
    if(p_vmDisplayname == null)
        return fromdb(p_vmName);
    
    var vmName = null;	
	if (p_vmDisplayname != p_vmName) {
		vmName = fromdb(p_vmName) + " (" + fromdb(p_vmDisplayname) + ")";
	} else {
		vmName = fromdb(p_vmName);
	}		
	return vmName;
}

// FUNCTION: Handles AJAX error callbacks.  You can pass in an optional function to 
// handle errors that are not already handled by this method.  
function handleError(XMLHttpResponse, handleErrorCallback) {
	// User Not authenticated
	if (XMLHttpResponse.status == ERROR_ACCESS_DENIED_DUE_TO_UNAUTHORIZED) {
		$("#dialog_session_expired").dialog("open");
	} 	
	else if (XMLHttpResponse.status == ERROR_INTERNET_NAME_NOT_RESOLVED) {
		$("#dialog_error_internet_not_resolved").dialog("open");
	} 
	else if (XMLHttpResponse.status == ERROR_INTERNET_CANNOT_CONNECT) {
		$("#dialog_error_management_server_not_accessible").dialog("open");
	} 
	else if (XMLHttpResponse.status == ERROR_VMOPS_ACCOUNT_ERROR && handleErrorCallback != undefined) {
		handleErrorCallback();
	} 
	else if (handleErrorCallback != undefined) {
		handleErrorCallback();
	}
	else {	  
		var errorMsg = parseXMLHttpResponse(XMLHttpResponse);				
		$("#dialog_error").text(fromdb(errorMsg)).dialog("open");
	}
}

// FUNCTION: Adds a Dialog to the list of active Dialogs so that
// when you shift from one tab to another, we clean out the dialogs
var activeDialogs = new Array();
function activateDialog(dialog, addToActive) {
	if (addToActive == undefined || addToActive) {
		activeDialogs[activeDialogs.length] = dialog;
	}
	
	//bind Enter-Key-pressing event handler to the dialog 	
	dialog.keypress(function(event) {
	    if(event.keyCode == keycode_Enter) {	        
	        $('[aria-labelledby$='+dialog.attr("id")+']').find(":button:first").click();	
	        return false; //event.preventDefault() + event.stopPropagation()
	    }    
	});
}
function removeDialogs() {
	for (var i = 0; i < activeDialogs.length; i++) {
		activeDialogs[i].remove();
	}
	activeDialogs = new Array();
}

function convertBytes(bytes) {
	if (bytes < 1024 * 1024) {
		return (bytes / 1024).toFixed(2) + " KB";
	} else if (bytes < 1024 * 1024 * 1024) {
		return (bytes / 1024 / 1024).toFixed(2) + " MB";
	} else if (bytes < 1024 * 1024 * 1024 * 1024) {
		return (bytes / 1024 / 1024 / 1024).toFixed(2) + " GB";
	} else {
		return (bytes / 1024 / 1024 / 1024 / 1024).toFixed(2) + " TB";
	}
}

function convertHz(hz) {
    if (hz == null)
        return "";

	if (hz < 1000) {
		return hz + " MHZ";
	} else {
		return (hz / 1000).toFixed(2) + " GHZ";
	} 
}

function toDayOfMonthDesp(dayOfMonth) {
    return "Day "+dayOfMonth +" of Month";
}

function toDayOfWeekDesp(dayOfWeek) {
    if (dayOfWeek == "1")
        return "Sunday";
    else if (dayOfWeek == "2")
        return "Monday";
    else if (dayOfWeek == "3")
        return "Tuesday";
    else if (dayOfWeek == "4")
        return "Wednesday";
    else if (dayOfWeek == "5")
        return "Thursday"
    else if (dayOfWeek == "6")
        return "Friday";
    else if (dayOfWeek == "7")
        return "Saturday";    
}

function toBooleanText(booleanValue) {
    if(booleanValue == true || booleanValue == "true")
        return "Yes";
    else if(booleanValue == false ||booleanValue == "false")
        return "No";
}

function toBooleanValue(booleanText) {
    if(booleanText == "Yes")
        return "true";
    else if(booleanText == "No")
        return "false";
}

function toNetworkType(usevirtualnetwork) {
    if(usevirtualnetwork == true || usevirtualnetwork == "true")
        return "Public";
    else
        return "Direct";
}

var roleTypeUser = "0";
var roleTypeAdmin = "1";
var roleTypeDomainAdmin = "2";
function toRole(type) {
	if (type == roleTypeUser) {
		return "User";
	} else if (type == roleTypeAdmin) {
		return "Admin";
	} else if (type == roleTypeDomainAdmin) {
		return "Domain-Admin";
	}
}

function toAlertType(alertCode) {
	switch (alertCode) {
		case 0 : return "Capacity Threshold - Memory";
		case 1 : return "Capacity Threshold - CPU";
		case 2 : return "Capacity Threshold - Storage Used";
		case 3 : return "Capacity Threshold - Storage Allocated";
		case 4 : return "Capacity Threshold - Public IP";
		case 5 : return "Capacity Threshold - Private IP";
		case 6 : return "Monitoring - Host";
		case 7 : return "Monitoring - VM";
		case 8 : return "Monitoring - Domain Router";
		case 9 : return "Monitoring - Console Proxy";
		case 10 : return "Monitoring - Routing Host";
		case 11 : return "Monitoring - Storage";
		case 12 : return "Monitoring - Usage Server";
		case 13 : return "Monitoring - Management Server";
		case 14 : return "Migration - Domain Router";
		case 15 : return "Migration - Console Proxy";
		case 16 : return "Migration - User VM";
		case 17 : return "VLAN";
		case 18 : return "Monitoring - Secondary Storage VM";
	}
}

// Timezones
var timezones = new Object();
timezones['Etc/GMT+12']='[UTC-12:00] GMT-12:00';
timezones['Etc/GMT+11']='[UTC-11:00] GMT-11:00';
timezones['Pacific/Samoa']='[UTC-11:00] Samoa Standard Time';
timezones['Pacific/Honolulu']='[UTC-10:00] Hawaii Standard Time';
timezones['US/Alaska']='[UTC-09:00] Alaska Standard Time';
timezones['America/Los_Angeles']='[UTC-08:00] Pacific Standard Time';
timezones['Mexico/BajaNorte']='[UTC-08:00] Baja California';
timezones['US/Arizona']='[UTC-07:00] Arizona';
timezones['US/Mountain']='[UTC-07:00] Mountain Standard Time';
timezones['America/Chihuahua']='[UTC-07:00] Chihuahua, La Paz';
timezones['America/Chicago']='[UTC-06:00] Central Standard Time';
timezones['America/Costa_Rica']='[UTC-06:00] Central America';
timezones['America/Mexico_City']='[UTC-06:00] Mexico City, Monterrey';
timezones['Canada/Saskatchewan']='[UTC-06:00] Saskatchewan';
timezones['America/Bogota']='[UTC-05:00] Bogota, Lima';
timezones['America/New_York']='[UTC-05:00] Eastern Standard Time';
timezones['America/Caracas']='[UTC-04:00] Venezuela Time';
timezones['America/Asuncion']='[UTC-04:00] Paraguay Time';
timezones['America/Cuiaba']='[UTC-04:00] Amazon Time';
timezones['America/Halifax']='[UTC-04:00] Atlantic Standard Time';
timezones['America/La_Paz']='[UTC-04:00] Bolivia Time';
timezones['America/Santiago']='[UTC-04:00] Chile Time';
timezones['America/St_Johns']='[UTC-03:30] Newfoundland Standard Time';
timezones['America/Araguaina']='[UTC-03:00] Brasilia Time';
timezones['America/Argentina/Buenos_Aires']='[UTC-03:00] Argentine Time';
timezones['America/Cayenne']='[UTC-03:00] French Guiana Time';
timezones['America/Godthab']='[UTC-03:00] Greenland Time';
timezones['America/Montevideo']='[UTC-03:00] Uruguay Time]';
timezones['Etc/GMT+2']='[UTC-02:00] GMT-02:00';
timezones['Atlantic/Azores']='[UTC-01:00] Azores Time';
timezones['Atlantic/Cape_Verde']='[UTC-01:00] Cape Verde Time';
timezones['Africa/Casablanca']='[UTC] Casablanca';
timezones['Etc/UTC']='[UTC] Coordinated Universal Time';
timezones['Atlantic/Reykjavik']='[UTC] Reykjavik';
timezones['Europe/London']='[UTC] Western European Time';
timezones['CET']='[UTC+01:00] Central European Time';
timezones['Europe/Bucharest']='[UTC+02:00] Eastern European Time';
timezones['Africa/Johannesburg']='[UTC+02:00] South Africa Standard Time';
timezones['Asia/Beirut']='[UTC+02:00] Beirut';
timezones['Africa/Cairo']='[UTC+02:00] Cairo';
timezones['Asia/Jerusalem']='[UTC+02:00] Israel Standard Time';
timezones['Europe/Minsk']='[UTC+02:00] Minsk';
timezones['Europe/Moscow']='[UTC+03:00] Moscow Standard Time';
timezones['Africa/Nairobi']='[UTC+03:00] Eastern African Time';
timezones['Asia/Karachi']='[UTC+05:00] Pakistan Time';
timezones['Asia/Kolkata']='[UTC+05:30] India Standard Time';
timezones['Asia/Bangkok']='[UTC+05:30] Indochina Time';
timezones['Asia/Ho_Chi_Minh']='[UTC+07:00] Vietnam Time';
timezones['Asia/Shanghai']='[UTC+08:00] China Standard Time';
timezones['Asia/Kuala_Lumpur']='[UTC+08:00] Malaysia Time';
timezones['Australia/Perth']='[UTC+08:00] Western Standard Time (Australia)';
timezones['Asia/Taipei']='[UTC+08:00] Taiwan';
timezones['Asia/Tokyo']='[UTC+09:00] Japan Standard Time';
timezones['Asia/Seoul']='[UTC+09:00] Korea Standard Time';
timezones['Australia/Adelaide']='[UTC+09:30] Central Standard Time (South Australia)';
timezones['Australia/Darwin']='[UTC+09:30] Central Standard Time (Northern Territory)';
timezones['Australia/Brisbane']='[UTC+10:00] Eastern Standard Time (Queensland)';
timezones['Australia/Canberra']='[UTC+10:00] Eastern Standard Time (New South Wales)';
timezones['Pacific/Guam']='[UTC+10:00] Chamorro Standard Time';
timezones['Pacific/Auckland']='[UTC+12:00] New Zealand Standard Time';
